home *** CD-ROM | disk | FTP | other *** search
- //************************************************************
- // This example is from JavaScript: The Definitive Guide, 3rd Edition.
- // That book and this example were Written by David Flanagan.
- // They are Copyright (c) 1996, 1997, 1998 O'Reilly & Associates.
- // This example is provided WITHOUT WARRANTY either expressed or implied.
- // You may study, use, modify, and distribute it for any purpose,
- // as long as this notice is retained.
- //<!-- Modified by: Kenneth C. Devoe, WildStorm Productions -->
- /*
- * Function getArgs() parses comma-separated name=value argument pairs from
- * the query string of the URL. It stores the name=value pairs in
- * properties of an object and returns that object.
- */
- function getArgs() {
- var args = new Object(); // Create the object.
- var query = location.search.substring(1); // Get query string.
- var pairs = query.split("&"); // Break at ampersand.
- for(var i = 0; i < pairs.length; i++) {
- var pos = pairs[i].indexOf('='); // Look for "name=value".
- if (pos == -1){
- continue; // If not found, skip.
- }
- var argname = pairs[i].substring(0,pos); // Extract the name.
- var value = pairs[i].substring(pos+1); // Extract the value.
- args[argname] = unescape(value); // Store as a property.
- }
- return args; // Return the object.
- }
-
- /*
- * Function myVoid() does nothing. It is used when the anchor tag has an event
- * such as OnMouseOver that uses a function. We want the function to be called
- * rather than the URL in the anchor tag called.
- */
- function myVoid(){}
-
- /*
- * Function popUpPage( page2, page, name, scroll) opens an html file in a
- * new browser window and centers the window on the user's computer screen.
- * This function is passed to it:
- * page2 - the URL of the HTML page to open.
- * page - the page type eg. cvr, p1, p2, p3.
- * name - the name to give the browser window.
- * scroll - the option of scroll bars on the browser window, yes or no.
- */
- function popUpPage( page2, page, name, scroll) {
- var h = (750); // height of the popup page.
- var w = (480); // width of the popup page.
- var win2X = (screen.width/2 - w/2); // Center popup page offset by it's width.
- var win2Y = 30; // Top of the popup page on the screen.
- winprops2 = 'height='+h+',width='+w+',top='+win2Y+',left='+win2X+',scrollbars='+scroll+',resizable'// properties of the browser window.
- page2 = page2 +"?itemCode="+itemCode[index]+"&itemIssue="+itemIssue[index]+"&page="+page // addition of name=value pairs to URL.
- win2 = window.open(page2, name, winprops2) // Opens the new browser window.
- if (parseInt(navigator.appVersion) >= 4) { win2.window.focus(); } // Give the new browser widow focus.
- }
-
- /*
- * Function update_frame(myoptions) opens a new web page in the current browser widow.
- * It is used by selecting an oprion on the drop down navigation forms.
- * This function is passed to it:
- * myoptions - object containing the URL of the HTML page to open.
- */
- function update_frame(myoptions) {
- destination=myoptions[myoptions.selectedIndex].value;
- if(destination=="null"){
- return true;
- }
- window.open(destination, '_self'); // Opens the new browser window.
- myoptions.selectedIndex=0;
- return true;
- }